
import { createRouter, createWebHistory } from 'vue-router'

import MainLayout from '@/components/MainLayout.vue'
import Login from '@/components/Login.vue'
import Activate from "@/components/Activate.vue";
import userBasicList from '@/components/user/UserBasicList.vue'
import salaryList from '@/components/salary/SalaryList.vue'
import salaryDetail from '@/components/salary/SalaryDetail.vue'
import SalaryEdit from '@/components/salary/SalaryEdit.vue'
import NoSalaryList from "../components/salary/NoSalaryList.vue";
import SalaryAdd from "../components/salary/SalaryAdd.vue";
import userBasicDetail from "../components/user/UserBasicDetail.vue";
import userBasicEdit from "../components/user/UserBasicEdit.vue";
import userBasicAdd from "../components/user/UserBasicAdd.vue";
import HouseFund from "../components/salary/HouseFund.vue";
import SalaryLevel from "../components/salary/SalaryLevel.vue";
import AgreementView from "../components/agreement/AgreementView.vue";
import EmploymentExamine from "../components/user/EmploymentExamine.vue";
import Home from "../components/Home.vue";
import UserBasicRegisterList from "../components/user/UserBasicRegisterList.vue";
import FlowView from "../components/flow/FlowView.vue";
import UserBasicAuditList from "../components/user/UserBasicAuditList.vue";
import userBasicAudit from "../components/user/UserBasicAudit.vue";
import UserBasicStartSalaryOne from "../components/user/UserBasicStartSalaryOne.vue";
import UserBasicAgreement from "../components/user/UserBasicAgreement.vue";
import UserBasicStartSalaryTwo from "../components/user/UserBasicStartSalaryTwo.vue";
import UserBasicStartSalaryList from "../components/user/UserBasicStartSalaryList.vue";
import SalaryMake from "../components/salary/SalaryMake.vue";
import SalaryRecheck from "../components/salary/SalaryRecheck.vue";

const router = createRouter({
    history: createWebHistory(),
    routes: [
        // { path: '/', component: MainLayout },
        { path: '/', redirect: '/hr/home'},
        {
            path: '/login',
            name: 'login',
            component: Login
        },
        {
            path: '/activate',
            name: 'activate',
            component: Activate
        },
        {
            path: '/hr',
            name: 'hr',
            component: MainLayout,
            children: [
                {
                    path: '/hr/home',
                    name: 'home',
                    component: Home
                },
                {
                    path: '/hr/userBasicRegisterList',
                    component: UserBasicRegisterList
                },
                {
                    path: '/hr/userBasicStartSalaryList',
                    name: 'userBasicStartSalaryList',
                    component: UserBasicStartSalaryList
                },
                {
                    path: '/hr/userBasicAuditList',
                    component: UserBasicAuditList
                },
                {
                    path: '/hr/userBasicList',
                    component: userBasicList
                },
                {
                    path: '/hr/employmentExamine',
                    name: 'employmentExamine',
                    component: EmploymentExamine
                },
                {
                    path: '/hr/userBasicDetail',
                    name: 'userBasicDetail',
                    component: userBasicDetail
                },
                {
                    path: '/hr/userBasicAudit',
                    name: 'userBasicAudit',
                    component: userBasicAudit
                },
                {
                    path: '/hr/userBasicEdit',
                    name: 'userBasicEdit',
                    component: userBasicEdit
                },
                {
                    path: '/hr/userBasicAdd',
                    name: 'userBasicAdd',
                    component: userBasicAdd
                },
                {
                    path: '/hr/userBasicStartSalaryOne',
                    name: 'userBasicStartSalaryOne',
                    component: UserBasicStartSalaryOne
                },
                {
                    path: '/hr/userBasicStartSalaryTwo',
                    name: 'userBasicStartSalaryTwo',
                    component: UserBasicStartSalaryTwo
                },
                {
                    path: '/hr/salaryList',
                    name: 'salaryList',
                    component: salaryList
                },
                {
                    path: '/hr/noSalaryList',
                    name: 'noSalaryList',
                    component: NoSalaryList
                },
                {
                    path: '/hr/salaryDetail',
                    name: 'salaryDetail',
                    component: salaryDetail
                },
                {
                    path: '/hr/salaryEdit',
                    name: 'salaryEdit',
                    component: SalaryEdit
                },
                {
                    path: '/hr/salaryAdd',
                    name: 'salaryAdd',
                    component: SalaryAdd
                },
                {
                    path: '/hr/salaryMake',
                    name: 'salaryMake',
                    component: SalaryMake
                },
                {
                    path: '/hr/salaryRecheck',
                    name: 'salaryRecheck',
                    component: SalaryRecheck
                },
                {
                    path: '/hr/houseFund',
                    name: 'houseFund',
                    component: HouseFund
                },
                {
                    path: '/hr/salaryLevel',
                    name: 'salaryLevel',
                    component: SalaryLevel
                },
                {
                    path: '/hr/userBasicAgreement',
                    name: 'userBasicAgreement',
                    component: UserBasicAgreement
                },
                {
                    path: '/hr/flowView',
                    name: 'flowView',
                    component: FlowView
                }
            ],
        }
    ]
})

// router.beforeEach((to, from, next) => {
//     if (from.path === '/') {
//         next('/hr/home');
//     } else {
//         next();
//     }
// })

export default router